package org.springblade.modules.mes.opcua.itf;

import org.springblade.core.tool.utils.SpringUtil;

public class OpcUa {

	private static OpcUaItf instance;

	public static OpcUaItf getInstance() {
		if (instance == null) {
			if (MesMode.mockFlag()) {
				instance = SpringUtil.getBean("mockOpcUa");
			} else {
				instance = SpringUtil.getBean("actOpcUa");
			}

		}
		return instance;
	}

	/**
	 * 初始化
	 */
	public void init() {
		instance.init();
		try {
			Thread.sleep(100);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
